import time

from selenium import webdriver

def driver_auto_download():
    # Selenium4.0以上版本使用该方法
    import os
    import shutil
    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    from webdriver_manager.microsoft import EdgeChromiumDriverManager

    # 指定驱动目标位置
    folder_path = r'F:\webDriver-root'
    # 路径拼接
    file_path = os.path.join(folder_path, 'msedgedriver.exe')

    # 使用ChromeDriverManager安装ChromeDriver，并获取驱动程序的路径
    download_driver_path = EdgeChromiumDriverManager().install()
    # 复制文件到目标位置
    shutil.copy(download_driver_path, folder_path)

    # 创建Chrome WebDriver，并指定驱动路径
    driver = webdriver.Chrome(service=Service(file_path))
    # 打开百度网页
    driver.get('https://m.diyibanzhu.me/wap.php?action=list&id=19333')
    time.sleep(10)

def demo():
    driver = webdriver.Edge()
    driver.get('https://m.diyibanzhu.me/wap.php?action=list&id=19333')
    time.sleep(10000)

if __name__ == '__main__':
    demo()
    # driver_auto_download()
